﻿
@{
    ViewBag.Title = "订单详情";
    Layout = "~/Views/Shared/_MallLayout.cshtml";
    var img_url = ViewBag.img_url;
}
@model token_bazaar_order_dto
<body class="page-myShareView page-order">
    @if (Model.status == EBazaarOrderStatus.Received) {
    <div class="mod-orderView market-order">
        <div class="state">
            <p class="fn28">待发货</p>
            <p class="fn48">@Model.price.ToString("f6")<em class="fn24">红钻</em></p>
            <i class="icon-time fn-right"></i>
        </div>
        <div class="delivery" >
            <div class="infor fn28 mb20">
                <div class="content fn28">
                    <p class="mb30">
                        <span class="col-gray2">收货人：</span>
                        <span class="fn-right">@Model.ship_name</span>
                    </p>
                    <p>
                        <span class="col-gray2">联系电话：</span>
                        <span class="fn-right">@Model.ship_phone</span>
                    </p>
                </div>
                <div class="address fn28">
                    <p>@Model.ship_region_name@Model.ship_address</p>
                </div>
            </div>
            <div class="pro mb20">
                <div class="itemPro border-box">
                    <div class="img">
                        <img src="@(img_url+Model.product_img)" />
                    </div>
                    <div class="text">
                        <p class="fn28 fn-bold mt30">
                           @Model.product_name
                        </p>
                    </div>
                </div>
                <div class="content fn28">
                    <p class="mb30">
                        <span class="col-gray2">买家昵称</span>
                        <span class="fn-right">@Model.buy_merchant_name</span>
                    </p>
                    <p class="mb30">
                        <span class="col-gray2">买家账号</span>
                        <span class="fn-right">@Model.buy_merchant_mobile</span>
                    </p>
                    <p class="mb30">
                        <span class="col-gray2">订单号</span>
                        <span class="fn-right">@Model.order_no</span>
                    </p>
                    <p>
                        <span class="col-gray2">创建时间</span>
                        <span class="fn-right">@Model.create_time</span>
                    </p>
                </div>
            </div>
            <div class="delivery_btn">
                <button type="button" class="close-delivery fn32 btn_cancle">取消交易</button>
                <button type="button" class="success-deliverybtn fn32" onclick="javascript:location.href='/BazaarOrder/OrderShip?id=@Model.id'">商品发货</button>
            </div>
        </div>
    </div>
    } else if (Model.status == EBazaarOrderStatus.Delivery) {
    <div class="mod-orderView market-order">
        <div class="state">
            <p class="fn28">待收货</p>
            <p class="fn48">@Model.price.ToString("f6")<em class="fn24">红钻</em></p>
            <i class="icon-time fn-right"></i>
        </div>
        <div class="logistics_wray">
            <div class="infor fn28 ">
                <div class="content fn28">
                    <p class="mb30">
                        <span class="col-gray2">收货人：</span>
                        <span class="fn-right">@Model.ship_name</span>
                    </p>
                    <p>
                        <span class="col-gray2">联系电话：</span>
                        <span class="fn-right">@Model.ship_phone</span>
                    </p>
                </div>
                <div class="address fn28">
                    <p>@(Model.ship_region_name + Model.ship_address)</p>
                </div>
            </div>
            <div class="check_logistics">
                @if (Model.shipping_type == 0) {
                    <a class="fn30" href="/BazaarOrder/OrderLogistics?id=@Model.id">查看物流信息   <em class="icon-go"></em></a>
                }
            </div>
            <div class="pro mb20">
                <div class="itemPro border-box">
                    <div class="img">
                        <img src="@(img_url+Model.product_img)" />
                    </div>
                    <div class="text">
                        <p class="fn28 fn-bold mt30">
                            @Model.product_name
                        </p>
                    </div>
                </div>
                <div class="content fn28">
                    <p class="mb30">
                        <span class="col-gray2">买家昵称</span>
                        <span class="fn-right">@Model.buy_merchant_name</span>
                    </p>
                    <p class="mb30">
                        <span class="col-gray2">买家账号</span>
                        <span class="fn-right">@Model.buy_merchant_mobile</span>
                    </p>
                    <p class="mb30">
                        <span class="col-gray2">订单号</span>
                        <span class="fn-right">@Model.order_no</span>
                    </p>
                    <p class="mb30">
                        <span class="col-gray2">发货时间</span>
                        <span class="fn-right">@Model.ship_time</span>
                    </p>
                    <p>
                        <span class="col-gray2">创建时间</span>
                        <span class="fn-right">@Model.create_time</span>
                    </p>
                </div>
            </div>
        </div>
    </div>
    } else if (Model.status == EBazaarOrderStatus.Cancle) {
    <div class="mod-orderView market-order">
        <div class="logistics_wray" style="display:none">
            <div class="state">
                <p class="fn28">交易取消</p>
                <p class="fn48">@Model.price.ToString("f6")<em class="fn24">红钻</em></p>
                <i class="icon-close3 fn-right"></i>
                <p class="fn24 retus">红钻已退回对方账户</p>
            </div>
            <div class="infor fn28 mb20">
                <div class="content fn28">
                    <p class="mb30">
                        <span class="col-gray2">收货人：</span>
                        <span class="fn-right">@Model.ship_name</span>
                    </p>
                    <p>
                        <span class="col-gray2">联系电话：</span>
                        <span class="fn-right">@Model.ship_phone</span>
                    </p>
                </div>
                <div class="address fn28">
                    <p>@(Model.ship_region_name + Model.ship_address)</p>
                </div>
            </div>
            <div class="pro mb20">
                <div class="itemPro border-box">
                    <div class="img">
                        <img src="@(img_url+Model.product_img)" />
                    </div>
                    <div class="text">
                        <p class="fn28 fn-bold mt30">
                            @Model.product_name
                        </p>
                    </div>
                </div>
                <div class="content fn28">
                    <p class="mb30">
                        <span class="col-gray2">买家昵称</span>
                        <span class="fn-right">@Model.buy_merchant_name</span>
                    </p>
                    <p class="mb30">
                        <span class="col-gray2">买家账号</span>
                        <span class="fn-right">@Model.buy_merchant_mobile</span>
                    </p>
                    <p class="mb30">
                        <span class="col-gray2">订单号</span>
                        <span class="fn-right">@Model.order_no</span>
                    </p>
                    <p class="mb30">
                        <span class="col-gray2">创建时间</span>
                        <span class="fn-right">@Model.create_time</span>
                    </p>
                    <p >
                        <span class="col-gray2">完成时间</span>
                        <span class="fn-right">@Model.finish_time</span>
                    </p>
                </div>
            </div>
        </div>
    </div>
    } else if (Model.status == EBazaarOrderStatus.Finish) {
    <div class="mod-orderView market-order">
        <div class="logistics_wray">

            <div class="state">
                <p class="fn28">交易完成</p>
                <p class="fn48">@Model.price.ToString("f6")<em class="fn24">红钻</em></p>
                <i class="icon-successful fn-right"></i>

            </div>
            <div class="infor fn28 mb20">
                <div class="content fn28">
                    <p class="mb30">
                        <span class="col-gray2">收货人：</span>
                        <span class="fn-right">@Model.ship_name</span>
                    </p>
                    <p>
                        <span class="col-gray2">联系电话：</span>
                        <span class="fn-right">@Model.ship_phone</span>
                    </p>
                </div>
                <div class="address fn28">
                    <p>@(Model.ship_region_name + Model.ship_address)</p>
                </div>
            </div>
            <div class="check_logistics">
                @if (Model.shipping_type == 0) {
                    <a class="fn30" href="/BazaarOrder/OrderLogistics?id=@Model.id">查看物流信息   <em class="icon-go"></em></a>
                }
            </div>
            <div class="pro mb20">
                <div class="itemPro border-box">
                    <div class="img">
                        <img src="@(img_url+Model.product_img)" />
                    </div>
                    <div class="text">
                        <p class="fn28 fn-bold mt30">
                            @Model.product_name
                        </p>
                    </div>
                </div>
                <div class="content fn28">
                    <p class="mb30">
                        <span class="col-gray2">买家昵称</span>
                        <span class="fn-right">@Model.buy_merchant_name</span>
                    </p>
                    <p class="mb30">
                        <span class="col-gray2">买家账号</span>
                        <span class="fn-right">@Model.buy_merchant_mobile</span>
                    </p>
                    <p class="mb30">
                        <span class="col-gray2">订单号</span>
                        <span class="fn-right">@Model.order_no</span>
                    </p>
                    <p class="mb30">
                        <span class="col-gray2">创建时间</span>
                        <span class="fn-right">@Model.create_time</span>
                    </p>
                    <p class="mb30">
                        <span class="col-gray2">发货时间</span>
                        <span class="fn-right">@Model.ship_time</span>
                    </p>
                    <p>
                        <span class="col-gray2">完成时间</span>
                        <span class="fn-right">@Model.finish_time</span>
                    </p>
                </div>
            </div>
        </div>
    </div>
    }
</body>
<script type="text/javascript">
    var flag = false;
    $(".btn_cancle").click(function () {
        layer.load(1);
        var id = @Model.id;
        if (flag) return;
        flag = true;
        $.ajax({
            //几个参数需要注意一下
            type: "POST",//方法类型
            dataType: "json",//预期服务器返回的数据类型
            url: "/BazaarOrder/Cancle",//url
            data: { id: id },
            success: function (result) {
                layer.closeAll('loading');
                if (result.result_code == 1000) {
                    layer.msg(result.result_msg);
                    setTimeout(function () {
                        location.href = '/BazaarOrder/SellOrder'
                    }, 1000);
                }
                else {
                    layer.msg(result.result_msg);
                }
                flag = false;
            },
            error: function () {
                layer.msg("异常！");
                flag = false;
            }
        });
    });
</script>

